home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_teo_statlock.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  261 lines

  1. # Jones 3D Cog Script
  2. #
  3. # TEO_STATLOCK.cog
  4. #
  5. # Controls gears and doors in statue lock room
  6. #
  7. # [SXC]
  8. #
  9. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     message        startup        
  14.     message        activated
  15.     message        arrived
  16.     message     blocked    
  17.     message        user0
  18.  
  19.     thing        gear0                    nolink
  20.     thing        gear1                    nolink
  21.     thing        gear2                    nolink
  22.     thing        gear3                    nolink
  23.     
  24.     thing        gearnode0                nolink
  25.     thing        gearnode1                nolink
  26.     thing        gearnode2                nolink
  27.     thing        gearnode3                nolink
  28.     thing        gearnode4                nolink
  29.     thing        gearnode5                nolink
  30.     thing        gearnode6                nolink
  31.     thing        gearnode7                nolink
  32.     thing        gearnode8                nolink
  33.     thing        gearnode9                nolink
  34.     thing        gearnodet                nolink
  35.     thing        gearnodee                nolink
  36.                                         
  37.     vector        curnodepos                local
  38.     vector        curgearpos                local
  39.     vector      newgearvector           local
  40.  
  41.     thing        aaxis                   linkid=3
  42.     thing        baxis                    linkid=3
  43.     thing        stopaxis                nolink
  44.     thing        statue                    nolink
  45.     thing        campos                    nolink
  46.     thing        gearswitch
  47.  
  48.     thing        indyTarget                nolink
  49.  
  50.     thing        indy                    nolink
  51.     thing        player                    local
  52.  
  53.     sound        gearbutsnd
  54.     sound        gearesetsnd
  55.     sound        gearRotSnd
  56.     sound       doorstop=olv_quetzdoor_stop_c.wav   local
  57.  
  58.     sound        indylineb0=inxj058.wav    local
  59.     sound        indylineb1=inxj059.wav    local
  60.     sound        indylineb2=inxj060.wav    local
  61.     sound        indylineb3=inxj061.wav    local
  62.     sound        indylineb4=inxj090.wav    local
  63.     sound        indylineb5=inxj095.wav    local
  64.     
  65.     int            gearchan                local
  66.     int            locked=0                local
  67.     int            count=0                    local
  68.     int            bSpoken=0                local
  69.     int         gearcount=0             local
  70.     int         nodecount=0             local
  71.  
  72.     flex        rotspeed=4.0            local
  73.     flex        moveSpeed=1.0            local
  74.     flex        diffpos=0                local
  75.  
  76.     vector        centerpos                local
  77.     vector        gearpos                    local
  78.  
  79. end
  80.  
  81. # ========================================================================================
  82.  
  83. code
  84.  
  85. startup:
  86.  
  87.     centerpos = GetThingPos(aaxis);
  88.     player = GetLocalPlayerThing();
  89.  
  90. return;
  91.  
  92. #........................................................................................
  93. activated:
  94.  
  95.     if (GetSenderRef() != gearswitch) return;
  96.     if (GetCurItem(player) != 0) return;
  97.     if (GetCurFrame(statue) != 3) return;
  98.     if (locked != 0) return;
  99.     
  100.     locked = 1;
  101.  
  102.     StopThing(player);
  103.     SetActorFlags(player, 0x200000);
  104.     DeselectWeaponWait(player);
  105.     StartCutscene(1);
  106.  
  107.     # Prep Actor
  108.     CopyPlayerHolsters(player, indy);
  109.     TeleportThing(indy, indyTarget);
  110.     CopyOrientAndPos(indy, player);
  111.     Sleep(0.01);
  112.     SetThingFlags(player, 0x80000);
  113.     ClearThingFlags(indy, 0x80000);
  114.  
  115.     # Camera...
  116.     SetExtCamOffset('0.15 0.0 0.05');
  117.     //SetExtCamLookOffset('0.0 0.05 0.0');
  118.  
  119.     MoveToFrame(gearswitch, 1, moveSpeed);
  120.     PlaySoundThing(gearbutsnd, gearswitch, 0.3, 3, 10, 0);
  121.     PlayMode(indy, 60, 1);
  122.  
  123.     for (count = 0; count <= 3; count = count + 1)
  124.     {
  125.         gearpos = GetThingPos(gear0[count]);
  126.         diffpos = VectorDist(gearpos, centerpos);
  127.         if ((diffpos > 0.2) && (diffpos < 0.275))
  128.         {
  129.             AttachThingtoThing(gear0[count], aaxis);
  130.         }
  131.         else if ((diffpos > 0.4) && (diffpos < 0.5))
  132.         {
  133.             AttachThingtoThing(gear0[count], baxis);
  134.         }
  135.         else if (diffpos > 0.55)
  136.         {
  137.             AttachThingtoThing(gear0[count], stopaxis);
  138.         }
  139.     }
  140.  
  141.     Sleep(0.5);
  142.     SetCameraFocus(0, campos);
  143.     SetCurrentCamera(0);
  144.  
  145.     gearchan = PlaySoundLocal(gearRotSnd, 0.85, 0, 0x0001, 0);
  146.  
  147.     SetCollideType(gear0, 0);
  148.     SetCollideType(gear1, 0);
  149.     SetCollideType(gear2, 0);
  150.     SetCollideType(gear3, 0);
  151.  
  152.     Rotate(aaxis, 90, 1, rotspeed);
  153.     Rotate(baxis, -90, 1, rotspeed);
  154.  
  155. return;
  156.  
  157. # ........................................................................................
  158.  
  159. arrived:
  160.  
  161.  
  162.     if (GetSenderRef() == aaxis)
  163.     {
  164.         if (locked != 1) return;
  165.  
  166.         StopSound(gearchan, 0);
  167.         PlaySoundLocal(doorstop, 1, 0, 0, 0);
  168.     
  169.         Sleep(0.5);
  170.         SetCurrentCamera(1);
  171.         MoveToFrame(gearswitch, 0, moveSpeed);
  172.         PlaySoundThing(gearesetsnd, gearswitch, 0.3, 3, 10, 0);
  173.         WaitForStop(gearswitch);
  174.     
  175.         SetThingFlags(indy, 0x80000);
  176.         ClearThingFlags(player, 0x80000);
  177.     
  178.         RestoreExtCam();
  179.  
  180.            if (bSpoken)
  181.         {
  182.             EndCutscene();
  183.             ClearActorFlags(player, 0x200000);
  184.         }
  185.         
  186.         # check nodes for gears
  187.         for (nodecount=0; nodecount<=3; nodecount=nodecount +1)
  188.         {
  189.             # innercircle
  190.             curnodepos = GetThingPos(gearnode0[nodecount]);    
  191.             for (gearcount=0; gearcount<=3; gearcount=gearcount+1)
  192.             {
  193.                 curgearpos = GetThingPos(gear0[gearcount]);
  194.                 if (VectorLen(VectorSub(curnodepos, curgearpos)) < 0.075)
  195.                 {
  196.                     newgearvector = VectorSet(VectorX(curnodepos), VectorY(curnodepos), VectorZ(curgearpos));   
  197.                     MoveThingToPos(gear0[gearcount], newgearvector, 0);
  198.                 }         
  199.             }
  200.             
  201.             # middlecircle
  202.             curnodepos = GetThingPos(gearnode0[nodecount + 4]);
  203.             for (gearcount=0; gearcount<=3; gearcount=gearcount+1)
  204.             {
  205.                 curgearpos = GetThingPos(gear0[gearcount]);
  206.                 if (VectorLen(VectorSub(curnodepos, curgearpos)) < 0.075)
  207.                 {
  208.                     newgearvector = VectorSet(VectorX(curnodepos), VectorY(curnodepos), VectorZ(curgearpos));   
  209.                     MoveThingToPos(gear0[gearcount], newgearvector, 0);
  210.                 }
  211.             }
  212.             
  213.             # outercircle
  214.             curnodepos = GetThingPos(gearnode0[nodecount + 8]);
  215.             
  216.             for (gearcount=0; gearcount<=3; gearcount=gearcount+1)
  217.             {
  218.                 curgearpos = GetThingPos(gear0[gearcount]);
  219.                 if (VectorLen(VectorSub(curnodepos, curgearpos)) < 0.075)
  220.                 {
  221.                     newgearvector = VectorSet(VectorX(curnodepos), VectorY(curnodepos), VectorZ(curgearpos));   
  222.                     MoveThingToPos(gear0[gearcount], newgearvector, 0);
  223.                 }
  224.             }
  225.         }
  226.     
  227.         locked = 0;
  228.         SetCollideType(gear0, 3);
  229.         SetCollideType(gear1, 3);
  230.         SetCollideType(gear2, 3);
  231.         SetCollideType(gear3, 3);
  232.     }
  233.  
  234. return;
  235.  
  236. # ........................................................................................
  237. blocked:
  238.  
  239.     if ((GetSenderRef() == gear0) ||
  240.         (GetSenderRef() == gear1) ||
  241.         (GetSenderRef() == gear2) ||
  242.         (GetSenderRef() == gear3))
  243.         
  244.     {
  245.         print("I'm being statlock blocked");
  246.         
  247.     }
  248.     
  249. return;
  250.  
  251. # ........................................................................................
  252.  
  253. user0: # Indicates that Azerim line has been spoken
  254.  
  255.     bSpoken = 1;
  256.     return;
  257.  
  258. #........................................................................................
  259.  
  260. end
  261.